home *** CD-ROM | disk | FTP | other *** search
- bOK = @TRUE
- szDial = "<dialupname>"
- szPgmPath = "<pgmpath>"
- szPgmDir = "<pgmdir>"
- bNewHdrs = <newhdrs>
- bSendMail = <sendmail>
- ;bGetMail = <getmail>
- bNewGroups = <newgroups>
- bCompact = <compact>
- szErrDesc = ""
- nWait = 10 ; How many minutes to wait for Agent to finish its work
-
-
- ;Dial our host (unless user is on a direct connect)...
- hConn = 0
- if (szDial <> "")
- hConn = SDialUp (szDial)
- nErr = SGetLastErr ()
- if (!hConn)
- switch nErr
- case @SErrNotFound
- szErrDesc = "Couldn't connect to %szDial% - no such dial-up"
-
- case nErr ; <--default
- szErrDesc = "Couldn't connect to %szDial% - error %nErr%"
- endswitch
- bOK = @FALSE
- goto LogIt
- else
- if (nErr == @SAlready)
- hConn = 0
- endif
- endif
- endif
-
-
- ; Run Agent & make it do things...
- szTitle = ""
- if (WinExist ("Free Agent")) then szTitle = "Free Agent"
- if (WinExist ("Agent")) then szTitle = "Agent"
- if (szTitle <> "")
- WinActivate (szTitle)
- else
- DirChange (szPgmDir)
- Run (szPgmPath, "")
- delay (6)
- if (WinExist ("Free Agent")) then szTitle = "Free Agent"
- if (WinExist ("Agent")) then szTitle = "Agent"
- endif
-
-
- ; Get new headers (if chosen)...
- if (bNewHdrs)
- SendKeysTo (szTitle, "!on")
- Delay (10)
- endif
-
- ; Update the group list (if chosen)...
- if (bNewGroups)
- SendKeysTo (szTitle, "!og")
- Delay (10)
- endif
-
- ; Get new mail (if chosen)...
- ;if (bGetMail)
- ; SendKeysTo (szTitle, "???")
- ; Delay (10)
- ;endif
-
- ; Send outgoing mail/articles (if chosen)...
- if (bSendMail)
- SendKeysTo (szTitle, "!op")
- Delay (10)
- endif
-
- ; Compact the database (if chosen)...
- ;if (bCompact)
- ; SendKeysTo (szTitle, "!fc")
- ;endif
-
-
- ; Wait for nWait minutes, or till user kills off Agent manually...
- for n=1 to nWait * 6
- if (WinExist (szTitle))
- Delay (10)
- endif
- next n
-
-
- ; If user hit Ctrl+Break, WIL will bring us here...
- :Cancel
-
- ; Hang up...
- :HangUp
- if (hConn)
- nRet = SHangUp (hConn)
- endif
-
-
- ; Log what we did...
- :LogIt
- if bOK == @TRUE
- szLog = "Ran Agent"
- else
- szLog = strcat ("Error attempting to automate Agent:", @CRLF, szErrDesc)
- endif
-
- CMLogMessage (szLog)
- exit
-
- ~
-